Conventionally, an operator having knowledge about an image correction manually carries out various kinds of corrections on an obtained image by trial and error to make an improvement in image quality. There are various kinds of image corrections, for example, a color balance correction for removing, when the entire image is colored and a color deviation exists wholly, the deviation, a range correction for adjusting a range of pixel values which can be taken, a tone correction for adjusting the brightness and contrast of a pixel, a color saturation correction for adjusting the vividness of an image, a contour emphasis correction for improving the sharpness of an image, and the like.
In a conventional technique of the color balance correction, mostly, a correction reference and a correction amount of color fog are estimated, and the estimated correction amount is uniformly used for the entire hue of an image to carry out the correction. However, for example, since the distribution of color saturation values is greatly different between the hue region of a Y system and the hue region of a G system, there has been a problem that if the correction amount is estimated from the whole color space in accordance with such a method, the accuracy is remarkably lowered.
Besides, for example, Japanese Patent Unexamined Publication No. 2000-13626 discloses a technique as follows: That is, when a color balance correction is made on a pixel of an input image, a correction amount is adjusted with the weight of a difference between a hue as a reference of the correction and a phase value of a pixel, and an estimated correction amount is uniformly used for the whole hue of the image. For example, as shown in FIG. 44, in the case where a dotted line indicates a color distribution before the correction on an LCH (lightness, color saturation, hue) plane, and an arrow indicates a color fog direction, when the technique disclosed in the publication is used, the color distribution before the correction is moved to a position as indicated by a solid line as it is. However, since a color region A which is not originally subjected to color fogging is also moved to a position of a region A′, there has been a defect that the color saturation/hue are greatly changed, and the color of the image is partially faded or blurred.
With respect to the range correction, the following method has been conventionally used. That is, a desired highlight pixel value and a shadow pixel value are determined in advance, and a highlight pixel which is a pixel having highest lightness and a shadow pixel which is a pixel having lowest lightness are searched from an input image. A pixel value of the searched highlight pixel is converted to a highlight pixel value, and a pixel value of the searched shadow pixel is converted to a shadow pixel value, and with respect to a pixel having a pixel value between the value of the searched highlight pixel and the value of the shadow pixel, a linear proportional calculation is made and it is converted to a pixel value between the highlight pixel value and the shadow pixel value.
If an input image is a monochromatic image having only lightness, the above method does not have any problem, however, in the case of a color image, a problem has arisen since a color balance is not considered. That is, when an image is expressed by RGB (red, green and blue of the three primary colors of light) and the range correction is made on the respective components of the RGB in accordance with the above method, in the case where a pixel having a color, for example, a highlight pixel, which is yellow (when expressed by pixel values, (RGB)=(200, 200, 100)), there occurs such a phenomenon that the pixel value of each of the RGB becomes high (RGB=(255, 255, 255)) and the color becomes white.
Thus, in order to keep the color balance, although there is a method for making the range correction while the ratio of the RGB is kept, in the case where the pixel value of the shadow pixel has a rather high pixel value (clear red (for example, RGB=(200, 150, 150)) in pixel values which can be taken, since a difference between the respective components of the RGB becomes small if the ratio of the RGB is merely kept, there has been a case where the sharpness of the input image is faded, for example, the clear red becomes faded red (RGB=(100, 75, 75)).
Besides, for example, Japanese Patent Unexamined Publication No. Hei. 8-32827 discloses a method in which in the case where an object of a range correction is a color image, the color image is converted into an LCH format, and the range correction is made as to L and C. In this case, since a pixel value may go out of a color space, which is allowed, color range compression is carried out to push the pixel value into a predetermined color space. In this method, although the range correction is enabled while the color balance is kept, there is a problem that it is judged whether a pixel after the range correction is in the predetermined color space, and if not, an operation of pushing the pixel value into the color space becomes necessary in surplus. Besides, in recent years, an image photographing apparatus such as a digital camera becomes popular, and there are many cases where an input image is expressed in RGB, and in the case where the method as disclosed in the publication is used, the cost of conversion of the RGB into the LCH is also needed in surplus.
Besides, with respect to an image which is not suitable in brightness and contrast, if the input image is an image in which a person is a main body, it is desirable that an image processing by a gradation correction curve or the like is carried out to adjust the brightness/gradation of a person portion, and in a case of an image in a backlight state, it is desirable that a gradation correction is carried out to adjust the brightness/gradation of a portion which becomes rather black by backlight. For example, Japanese Patent No. 3018914 discloses a method of recognizing a main portion of an image and correcting a gradation. That is, an image is divided into a plurality of small regions, and an analysis of a person and an analysis of backlight are carried out, so that the input image is classified into four types (combinations of presence/non-presence of a person and presence/non-presence of a backlight), and a person degree and a backlight degree of the entire image are calculated. Besides, a previously obtained weight value (person reliability, backlight reliability, and reliability of other images) is acquired, models of previously obtained three types of gradation correction curves (for person correction, for backlight correction, and for correction of other images) and weight values are subjected to a product-sum calculation, and a final gradation correction curve is calculated. However, in this method, since by estimating the degree of the person or the backlight with respect to the whole image, the gradation correction curve is prepared, even if the input image is divided into the small regions and the image analysis is carried out with considerable effort, the portion of the person or the backlight is not specified. Accordingly, even if the image is judged to be the person or the backlight, there occurs a case where with respect to the image in which brightness or contrast is not suitable, the portion of the person or the backlight is not corrected to a desired gradation.
Besides, in recent years, although a technique of automating the operations of an operator has been developed, since the correction is carried out uniformly without giving attention to the preference and tendency of the operator at the time of the image correction, there occurs a case where the result of an automatic image correction, such as a color saturation correction or a contour emphasis correction, becomes greatly different from the object of the operator.
As described above, conventionally, there has not been a suitable automatic image correcting technique.